package test.y2019.december;

import cn.hutool.core.lang.Console;
import cn.hutool.json.JSONUtil;

import java.util.*;

/**
 * Created By  醉美柳舞之众星捧月
 *
 * @author song
 * @date 2019/12/2 15:10
 */
public class December1 {
    public static void main(String[] args) {

        List<String> master = Arrays.asList("server", "value", "web");

        List<String> server = Arrays.asList("server1", "server2", "server3");
        List<String> value = Arrays.asList("value1", "value2", "value3");
        List<String> web = Arrays.asList("web1", "web2", "web3");

        Map<String, List<String>> hashMap = new HashMap<>(6);
        hashMap.put("server", server);
        hashMap.put("value", value);
        hashMap.put("web", web);

        List<String> list = new ArrayList<>();

        for (int i = 0; i < master.size(); i++) {
            String s = master.get(i);
            Console.error("当母体为：{}的时候 ==》", s);
            if (hashMap.containsKey(s)) {
                List<String> strings = hashMap.get(s);
                list.addAll(strings);
            }
        }
        Console.error(JSONUtil.toJsonPrettyStr(list));
    }
}
